#pragma once

#include "InnerMath.hpp"
#include "Reference.hpp"

class Object : public Reference
{
public:

    virtual bool rayIntersect(const vec3& start, const vec3& end, vec3& hit, vec3& n) const = 0;

    enum Shape
    {
        None = 0,
        Rect,
        Sphere,
        Box,
    };

    Shape shape() const { return _shape; }

    const vec3& position() const { return _pos; }
    const quat& rotation() const { return _rot; }
    const vec4& color()    const { return _color; }

    vec3& position() { return _pos; }
    quat& rotation() { return _rot; }
    vec4& color()    { return _color; }

protected:
    Shape _shape = None;
    vec3 _pos;
    quat _rot;
    vec4 _color = vec4(1);
};

class Sphere : public Object 
{
public:
    Sphere(const vec3& center = vec3(0), scalar radius = fOne);

    virtual bool rayIntersect(const vec3& start, const vec3& end, vec3& hit, vec3& n) const override;

protected:
    vec3 _center;
    scalar _radius;
};